package org.design.hotdevelop.service;

import cn.hutool.core.map.MapUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @description:
 * @author: freedom
 * @date: 2024/10/31
 **/
@Service
@Slf4j
public class SwitchService {

    public static final Map<String,String> SWITCH_MAP = MapUtil.newHashMap();

    public SwitchService(){
        SWITCH_MAP.put("OrderService","0");
    }
    public Map<String,String> update (Map<String,Object> param) {
        Map<String,String> returnMap = MapUtil.newHashMap();
        String aClass = MapUtil.getStr(param,"class");
        if(SWITCH_MAP.get(aClass)==null){
            returnMap.put("msg","开关不存在!");
            return returnMap;
        }
        SWITCH_MAP.put(aClass.split("\\.")[0],MapUtil.getStr(param,"state"));
        returnMap.put("msg","修改完成!");
        return returnMap;
    }
}
